package com.wanshu.controller;


import com.alibaba.fastjson.JSON;
import com.wanshu.entity.Task;
import com.wanshu.service.TaskService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@CrossOrigin("http://localhost:8080")
@RequestMapping("/task")
public class TaskController {

    @Resource
    TaskService taskService;

    @RequestMapping("/findAll")  //查询所有任务
    public String findAll(){
        List<Task> all = taskService.findAll();
        System.out.println(all);
        return JSON.toJSONString(all);
    }
}
